avro_derive
A proc-macro module for automatically deriving the avro schema for structs or enums. The macro produces the logic necessary to implement the AvroSchema
trait for the type.
How-to use
Add the "derive" feature to your apache-avro dependency inside cargo.toml
apache-avro = { version = "X.Y.Z", features = ["derive"] }
Add to your data model
Example
use Writer;
// derived schema, always valid or code fails to compile with a descriptive message
let schema = get_schema;
let mut writer = new;
let test = Test ;
writer.append_ser.unwrap;
let encoded = writer.into_inner;
Compatibility Notes
This module is designed to work in concert with the Serde implementation. If your use case dictates needing to manually convert to a Value
type in order to encode then the derived schema may not be correct.